<?php
/* @var $this ContactController */
/* @var $model Contact */
/* @var $form CActiveForm */

CHtml::$errorContainerTag = 'span';
$error = $model->getErrors();

?>
<!-- Please call pinit.js only once per page -->
<div id="fb-root"></div>
<script type="text/javascript">(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
<div class="sub-page">
    <h2>Contact</h2>
    <?php if(Yii::app()->user->hasFlash('success')):?>
        <div class="info">
           <p class="green-text"> <?php echo Yii::app()->user->getFlash('success'); ?></p>
        </div>
    <?php endif; ?>
    <div class="all-product">
        <?php
        $companyInfo = Company::model()->findByPk($id=1);
        if(!empty($companyInfo)) {
            echo $companyInfo->content;
        }
        ?>
        <div class="contact">
            <div class="ct-title">Location</div>
            <div class="form-style marT20">
                <?php echo $companyInfo->map;?>
            </div>
        </div>
        <?php $form=$this->beginWidget('CActiveForm', array(
            'id'=>'contact-form',
            // Please note: When you enable ajax validation, make sure the corresponding
            // controller action is handling ajax validation correctly.
            // There is a call to performAjaxValidation() commented in generated controller code.
            // See class documentation of CActiveForm for details on this.
            'enableAjaxValidation'=>false,
        )); ?>

        <div class="contact">
            <div class="ct-title">Contact Us</div>
            <div class="form-style marT20">
                <p>
                    <?php echo $form->labelEx($model,'name'); ?>
                    <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
                    <?php if (isset($error['name'])){ ?>
                    <div class="red-text">
                    <label></label>
                    <?php echo $form->error($model,'name'); ?>
                    </div>
                    <?php }?>
                </p>
                <p>
                    <?php echo $form->labelEx($model,'email'); ?>
                    <?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
                    <?php if (isset($error['email'])){ ?>
                    <div class="red-text">
                    <label></label>

                    <?php echo $form->error($model,'email'); ?>
                    </div>
                    <?php }?>
                </p>
                <p>
                    <?php echo $form->labelEx($model,'message'); ?>
                    <?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>50)); ?>
                    <?php if (isset($error['message'])){ ?>
                    <div class="red-text">
                    <label></label>

                    <?php echo $form->error($model,'message'); ?>
                    </div>
                    <?php }?>
                </p>
                <p>
                    <label>&nbsp;</label>
                    <span>* Required information</span>
                </p>
                <p>
                    <label>&nbsp;</label>
                    <?php echo CHtml::submitButton('Send', array('class'=>'red-button')); ?>
                </p>
            </div>
        </div>
        <?php $this->endWidget(); ?>
    </div>
</div>